package com.lzh.compiler.parcelerdemo;

import com.lzh.compiler.parceler.annotation.Arg;
import com.lzh.compiler.parceler.annotation.BundleBuilder;
import com.lzh.compiler.parcelerdemo.base.BaseAbility;
import ohos.aafwk.content.Intent;
import ohos.agp.components.TextField;

@BundleBuilder
public class LoginAbility extends BaseAbility {

    @Arg("username")
    private String username;
    @Arg("password")
    String password;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_login_ablity);
        ((TextField) findComponentById(ResourceTable.Id_username)).setText(username);
        ((TextField) findComponentById(ResourceTable.Id_password)).setText(password);
    }
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public void onBackPressed() {
        setResult(1, Intent.parseUri("as"));
        terminateAbility();
    }
}

